package com.example.demo.service;

import com.example.demo.mapper.SaleMapper;
import com.example.demo.pojo.Sale;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Date;
import java.util.List;
@Service
@Transactional
public class SaleServiceImpl implements SaleService{
    @Autowired
    SaleMapper saleMapper;
    @Override
    public int addSale(Sale sale) {
        Date date=new Date();
        sale.setSaledate(date);
        return saleMapper.insertSale(sale);
    }

    @Override
    public List<Sale> getAllSale() {
        return saleMapper.selectAllSale();
    }
}
